package com.codefish.controller;

import java.util.Arrays;
import java.util.Map;

import com.codefish.entity.SysPermissionPointEntity;
import com.codefish.service.SysPermissionPointService;
import com.codefish.util.R;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;



/**
 * 功能
 *
 * @author codefish
 * @email cool_fish@aliyun.com
 * @date 2021-04-15 06:13:14
 */
@RestController
@RequestMapping("/sysPermissionPoint")
public class SysPermissionPointController {
    @Autowired
    private SysPermissionPointService sysPermissionPointService;


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("generator:syspermissionpoint:info")
    public R info(@PathVariable("id") Long id){
		SysPermissionPointEntity sysPermissionPoint = sysPermissionPointService.getById(id);

        return R.ok().put("sysPermissionPoint", sysPermissionPoint);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("generator:syspermissionpoint:save")
    public R save(@RequestBody SysPermissionPointEntity sysPermissionPoint){
		sysPermissionPointService.save(sysPermissionPoint);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("generator:syspermissionpoint:update")
    public R update(@RequestBody SysPermissionPointEntity sysPermissionPoint){
		sysPermissionPointService.updateById(sysPermissionPoint);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("generator:syspermissionpoint:delete")
    public R delete(@RequestBody Long[] ids){
		sysPermissionPointService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
